<?php 
session_start();
header ("Content-Type:text/html; charset=UTF-8");

include "conexao.php";
connect();

$database_connTutoiMasters = $dbname;

//$connTutoiMasters = mysql_connect("host=$host port=$port dbname=$database_connTutoiMasters user=$user password=$password");	

?>
<br><br>
<table style="width:80%; border:solid 1px #333333;" cellpadding="4" cellspacing="4">
<tr>
                            
                                <td style="background-color: #049cdb; color: #FFFFFF;"><b>Id</b></td>
                                <td style="background-color: #049cdb; color: #FFFFFF;"><b>Nome Projeto</b></td>
                                <td style="background-color: #049cdb; color: #FFFFFF;"><b>Proponente</b></td>
                                <td style="background-color: #049cdb; color: #FFFFFF;"><b>Grupo / Companhia</b>
                                <td style="background-color: #049cdb; color: #FFFFFF;"><b>Cidade</b></td>
                                <td style="background-color: #049cdb; color: #FFFFFF;"><b>UF</b>
                                <td style="background-color: #049cdb; color: #FFFFFF;"><b>Região</b>
                                <td style="background-color: #049cdb; color: #FFFFFF;"><b>Categoria</b>
                                <td style="background-color: #049cdb; color: #FFFFFF;"><b>Modulo</b>
                                <td style="background-color: #049cdb; color: #FFFFFF;"><b>Email</b>
                                <td style="background-color: #049cdb; color: #FFFFFF;"><b>Telefone</b>
                                <td style="background-color: #049cdb; color: #FFFFFF;"><b>Inabilitado</b></td>
                                <td style="background-color: #049cdb; color: #FFFFFF;"><b>Nota Final</b></td>
                                <td style="background-color: #049cdb; color: #FFFFFF;"><b>Data</b></td>
								<td style="background-color: #049cdb; color: #FFFFFF;"><b>Excluir</b></td>
</tr>
<?php
$colname_rsBusca = "-1";
if (isset($_GET['q'])) {
  $colname_rsBusca = (get_magic_quotes_gpc()) ? $_GET['q'] : addslashes($_GET['q']);
}

$query_rsBusca = sprintf("select r.id_resultado, r.id_resultados, r.id_projeto, r.nome_projeto, r.proponente, r.grupo, r.cidade, u.sigla, u.regiao, c.nome as categoria, r.modulo, r.email, r.telefone, r.status, r.nota_final, r.data
						 from resultado r, uf u, projeto p, usuario us, categoria c 
						 where r.id_uf = u.id_uf and
							   r.id_projeto = p.id_projeto and
							   r.id_usuario = us.id_usuario and
							   r.id_categoria = c.id_categoria and
							   (r.id_resultados LIKE '%%%s%%' OR r.nome_projeto LIKE '%%%s%%' OR r.proponente LIKE '%%%s%%') order by r.id_resultados LIMIT 60", $colname_rsBusca,$colname_rsBusca,$colname_rsBusca);

$rsBusca = mysql_query($query_rsBusca) or die("Erro");
$row_rsBusca = mysql_fetch_assoc($rsBusca);
$totalRows_rsBusca = mysql_num_rows($rsBusca);
?>
<?php $counter = 4; do { ?>


<?
				$idresultado = $row_rsBusca['id_resultado'] ;
				$idprojeto = $row_rsBusca['id_projeto'] ;
				
				// Colorir linha sim, linha n�o ####################
				$cont = $cont + 1;
				if ($cont % 2) { $bg = "#FFF"; } else {
				$bg = "#E2E2E2"; }
				// Colorir linha sim, linha n�o ####################
				
?>

<tr>
                                        <td style="background-color:<? echo $bg; ?>">
										<? echo "<a href='avaliarprojeto.php?modo=atu&idresultado=$idresultado&idprojeto=$idprojeto'>"; ?>
										<label><?php echo $row_rsBusca['id_resultados'] ?></label></td>
                                        <td style="background-color:<? echo $bg; ?>">
										<? echo "<a href='avaliarprojeto.php?modo=atu&idresultado=$idresultado&idprojeto=$idprojeto'>"; ?>
										<label><?php echo urlencode($row_rsBusca['nome_projeto']); ?></label></td>
                                        <td style="background-color:<? echo $bg; ?>">
										<label><?php echo urlencode($row_rsBusca['proponente']); ?></label></td>
                                        <td style="background-color:<? echo $bg; ?>">
										<label><?php echo urlencode($row_rsBusca['grupo']); ?></label></td>
                                        <td style="background-color:<? echo $bg; ?>">
										<label><?php echo urlencode($row_rsBusca['cidade']); ?></label></td>
										<td style="background-color:<? echo $bg; ?>">
										<label><?php echo urlencode($row_rsBusca['sigla']); ?></label></td>
										<td style="background-color:<? echo $bg; ?>">
										<label><?php echo urlencode($row_rsBusca['regiao']); ?></label></td>
                                        <td style="background-color:<? echo $bg; ?>">
										<label><?php echo urlencode($row_rsBusca['categoria']); ?></label></td>
                                        <td style="background-color:<? echo $bg; ?>">
										<label><?php echo $row_rsBusca['modulo'] ?></label></td>
                                        <td style="background-color:<? echo $bg; ?>">
										<label><?php echo $row_rsBusca['email'] ?></label></td>
                                        <td style="background-color:<? echo $bg; ?>">
										<label><?php echo $row_rsBusca['telefone'] ?></label></td>
										<td style="background-color:<? echo $bg; ?>">
										<label><?php echo $row_rsBusca['status'] ?></label></td>
                                        <td style="background-color:<? echo $bg; ?>">
										<label><?php echo $row_rsBusca['nota_final'] ?></label></td>
                                        <td style="background-color:<? echo $bg; ?>">
										<label><?php echo $row_rsBusca['data'] ?></label></td>	
										<td style="background-color:<? echo $bg; ?>">
										<a href="dao/removeravaliacaoprojeto.php?modo=busc&idresultado=<? echo $idresultado ?>&idprojeto=<? echo $idprojeto ?>" onclick="return confirm('Confirma exclusão do registro <?php echo $row_rsBusca['id_resultados'] ?>')"><i class="icon-trash"></i> Excluir</a>										
                                    </tr>

<?php $counter++; } while ($row_rsBusca = mysql_fetch_assoc($rsBusca)); ?>
<?php
mysql_free_result($rsBusca);
?>

